package com.lemurian.bankdata.utils;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.ParameterNameAware;

/*
 * @author aditya
 */

public class EsapiAction extends ActionSupport implements SessionAware, ServletContextAware, ServletResponseAware, ServletRequestAware, ParameterNameAware {

	private static final long serialVersionUID = 1L;
	
	private Map<String, Object> session;
    private ServletContext servletContext;
    private HttpServletResponse response;
    private HttpServletRequest request;

    public EsapiAction() {
    }

    public HttpServletRequest getRequest() {
        return request;
    }

    public void setRequest(HttpServletRequest request) {
        this.request = request;
    }

    public HttpServletResponse getResponse() {
        return response;
    }

    public void setResponse(HttpServletResponse response) {
        this.response = response;
    }

    public void setSession(Map<String, Object> session) {
        this.session = session;
    }

    public void setServletContext(ServletContext servletContext) {
        this.servletContext = servletContext;
    }

    public void setServletResponse(HttpServletResponse response) {
        this.response = response;
    }

    public void setServletRequest(HttpServletRequest request) {
        this.request = request;
    }

    public ServletContext getServletContext() {
        return servletContext;
    }

    public Map<String, Object> getSession() {
        return session;
    }

    public boolean acceptableParameterName(String paramName) {
        return !paramName.matches("^session\\..*");
    }
}